<!-- head -->
{include file='public/head' /}
<!-- head -->

<!-- left -->
{include file='public/left' /}
<!-- left -->

<div class="content-wrapper">
    <section class="content-header">
        <h1>
            项目列表
            <small>全部项目</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 项目管理</a></li>
            <li class="active">项目列表</li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">共计{$itemList->total()}条记录</h3>
                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table table-bordered table-striped">
                                <form id='iform' action="{:url('Item/ItemList')}" method="get">
                                    <div class="input-group">
                                        <input type="text" name="item_name" value="{$item_name}" class="form-control" placeholder="请输入项目名...">
                                        <span class="input-group-btn">
                                            <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                                            </button>
                                        </span>
                                    </div>
                                </form>
                                <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>店铺名称</th>
                                        <th>项目名称</th>
                                        <th>项目分类</th>
                                        <th>项目模块</th>
                                        <th>项目单价</th>
                                        <th>疗程价</th>
                                        <th>销售数量</th>
                                        <th>浏览数量</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {volist name='itemList' id='admin'}
                                    <tr>
                                        <td>{$admin.id}</td>
                                        <td>{$admin.store.store_name}</td>
                                        <td>{$admin.item_name}</td>
                                        <td>{$admin.itemsimgclass.name}</td>
                                        <td>
                                            {if condition="$admin.type eq 0"}默认
                                            {elseif condition="$admin.type eq 1"/}店长推荐
                                            {elseif condition="$admin.type eq 2"/}新项目
                                            {elseif condition="$admin.type eq 3"/}会员特惠区
                                            {elseif condition="$admin.type eq 4"/}仓库
                                            {/if}
                                        </td>
                                        <td>{$admin.item_price}</td>
                                        <td>{$admin.item_prices}</td>
                                        <td>{$admin.sell_count}</td>
                                        <td>{$admin.visit_count}</td>
                                        <td style="width: 150px; text-align:right;">
                                            <button type="button" class="btn btn-sm bg-olive" data-url="{:url('admin/Item/CommentList',['item_id'=>$admin.id],'')}" onclick="ShowMessage(this)">查看评价 </button>&nbsp;
                                            <button type="button" class="btn btn-sm bg-aqua" data-url="{:url('admin/Item/ItemPreview',['id'=>$admin.id],'')}" onclick="ShowMessage(this)">预览 </button>&nbsp;
                                        </td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="box-footer clearfix" style="text-align: center">
                        {$itemList->render()}
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">

    var dataId = 0;
    function edit(obj) {
        var url = $(obj).data('url');
        window.location.href = url;
    }
    function ShowMessage(obj) {
        var url = $(obj).data('url');
        window.location.href = url;
    }

    function del(id) {
        dataId = id;
        showConfirm('删除', '确认删除？', delManager);
    }

    function delManager() {
        $.ajax({
            url: "{:url('admin/Store/DelStore','','')}",
            type: 'GET',
            data: {
                'id': dataId,
            },
            dataType: 'JSON',
            success: function (data) {
                showAlert('提示', data.msg, null);
                if (data.code == 1) {

                }
            }
        });
    }

</script>

<!-- foot -->
{include file='public/foot' /}
<!-- foot -->